<?php 

namespace app\admin\validate;

use think\Validate;

Class User extends Validate
{

	protected $rule = [
		'tel' => ['require', 'max'=>11, 'regex'=>'/^1[3-9]\d{9}/'],
		'password' => ['require', 'min'=>8, 'max'=>20],
        'email' => ['require','min'=>8, 'max'=>40, 'email']
    ];
    
    protected $message = [
    	'tel' => ['require'=>'手机号码不能为空', 'max'=>'手机号码必须11位', 'regex'=>'手机格式不合法'],
    	'password' => ['require'=>'密码不能为空', 'min'=>'密码不得少于8位', 'max'=>'密码不得大于20位'],
        'email' =>  ['require'=>'邮箱不能为空', 'min'=>'邮箱地址长度不合法', 'max'=>'邮箱地址长度不合法', 'email'=>'邮箱格式不合法']
    ];

    // 设置验证场景 场景名 对应场景验证的字段
    protected $scene = [
        'create'  =>  ['tel','password', 'email'],
        'update'  =>  ['tel', 'email'],
        'updatePass' => ['password'],
    ];


}